package com.ywu.mq.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.mq.sdk.domain.dto.YwuKafkaDto;
import com.ywu.mq.sdk.domain.entity.YwuKafkaConsumerLogEntity;
import com.ywu.mq.sdk.domain.entity.YwuKafkaProduceMessageEntity;
import com.ywu.mq.standard.service.YwuKafkaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *
 * @author Administrator
 * @date 2025/11/02
 */
@RestController
@RequestMapping("/ywu/mq/kafka/sdk")
public class YwuKafkaSdkApi {

    @Autowired
    private YwuKafkaService service;

    /**
     * @Author GroundDemo
     * @Description 校验主题是否存在
     * @Date 11:01 2025/3/28
     * @Param [logEntity]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/kafka.produce.check.topic.info")
    public CommonResult<Object> produceCheckTopic(@RequestBody YwuKafkaProduceMessageEntity logEntity) {
        return service.produceCheckTopic(logEntity);
    }

    /**
     * @Author GroundDemo
     * @Description 记录发送日志
     * @Date 10:36 2025/3/28
     * @Param [logEntity]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/kafka.create.produce.message.info")
    public CommonResult<Object> produceCreateMessage(@RequestBody YwuKafkaProduceMessageEntity logEntity) {
        return service.produceCreateMessage(logEntity);
    }

    /**
     * @Author GroundDemo
     * @Description 校验当前主题是否有消费的权限
     * @Date 16:49 2025/3/28
     * @Param [ywuKafkaDto]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/kafka.consumer.check.topic.info")
    public CommonResult<Object> checkConsumerPermission(@RequestBody YwuKafkaDto ywuKafkaDto) {
        return service.checkConsumerPermission(ywuKafkaDto);
    }

    /**
     * @Author GroundDemo
     * @Description 记录消费日志
     * @Date 18:55 2025/3/28
     * @Param [ywuKafkaConsumer]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/kafka.create.consumer.log.info")
    public CommonResult<Object> createConsumerLog(@RequestBody YwuKafkaConsumerLogEntity ywuKafkaConsumer) {
        return service.createConsumerLog(ywuKafkaConsumer);
    }
}
